package com.example.asus.homework11;


import com.example.asus.homework11.bean.CartBean;
import com.example.asus.homework11.bean.CollectListBean;
import com.example.asus.homework11.bean.CommentBean;
import com.example.asus.homework11.bean.FoodListBean;
import com.example.asus.homework11.bean.LoginBean;
import com.example.asus.homework11.bean.RegisterBean;
import com.example.asus.homework11.bean.ResultBean;
import com.example.asus.homework11.bean.ShopBean;
import com.example.asus.homework11.bean.UploadBean;
import com.example.asus.homework11.bean.UserBean;

import java.util.List;

import okhttp3.MultipartBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface Service {

    //登陆
    @GET("userLogin.do")
    Call<LoginBean> login(@Query("username") String username,
                          @Query("userpass") String userpass);

    //注册
    @GET("userRegister.do")
    Call<RegisterBean> register(@Query("username") String username,
                                @Query("userpass") String userpass,
                                @Query("mobilenum") String mobilenum);

    //获取店铺列表
    @GET("getAllShops.do")
    Call<List<ShopBean>> getShop();

    //获取店铺菜单
    @GET("getFoodByShop.do")
    Call<List<FoodListBean>> getFoodByShop(@Query("shop_id") int shop_id);

    //直接购买
    @GET("insertOrder.do")
    Call<ResultBean> doBuy(@Query("user_id") int user_id,
                           @Query("food_id") int food_id,
                           @Query("num") int num,
                           @Query("sum") double sum,
                           @Query("suggesttime") String suggesttime,
                           @Query("address ") String address);

    //获取店铺详情
    @GET("getFoodById.do ")
    Call<ShopBean> getShopDetail(@Query("shop_id") int shop_id);

    //获取菜谱详情
    @GET("getShopById.do")
    Call<ShopBean> getFoodDetail(@Query("food_id") int food_id);

    //获取菜谱评价
    @GET("getAllCommentsByFood.do")
    Call<List<CommentBean>> getComments(@Query("food_id") int food_id);

    //判断是否收藏
    @GET("isCollected.do")
    Call<ResultBean> isCollected(@Query("user_id") int user_id,
                                 @Query("shop_food_id") int shop_food_id,
                                 @Query("flag") int flag);

    //收藏/取消收藏店铺
    @GET("userCollectShop.do")
    Call<ResultBean> doCollectShop(@Query("user_id") int user_id,
                                   @Query("shop_id") int shop_id);

    //收藏/取消收藏菜谱
    @GET("userCollectFood.do")
    Call<ResultBean> doCollectFood(@Query("user_id") int user_id,
                                   @Query("food_id") int food_id);

    //获取收藏列表
    @GET("getAllUserCollection.do")
    Call<List<CollectListBean>> getCollectList(@Query("user_id") int user_id,
                                               @Query("flag") int flag);

    //搜索
    @GET("getFoodBySearch.do")
    Call<List<FoodListBean>> getSearch(@Query("search") String search);

    //获取用户所有订单
    @GET("getAllOrdersByUser.do")
    Call<List<CommentBean>> getAllOrders(@Query("user_id") int user_id);

    //获取用户所有评论
    @GET("getAllCommentsByUser.do")
    Call<List<CommentBean>> getAllComments(@Query("user_id") int user_id);

    //增加评论信息
    @GET("insertComment.do")
    Call<ResultBean> insertComment(@Query("item_id") int item_id,
                                   @Query("content") String content);

    //修改评论信息
    @GET("updateComment.do")
    Call<ResultBean> updateComment(@Query("item_id") int item_id,
                                   @Query("content") String content);

    //删除评论信息
    @GET("deleteComment.do")
    Call<ResultBean> deleteComment(@Query("item_id") int item_id);

    //获取用户信息
    @GET("getUserById.do")
    Call<UserBean> getUser(@Query("user_id") int user_id);

    //修改用户信息
    @GET("updateUserById.do")
    Call<ResultBean> updateUser(@Query("user_id") int user_id,
                                @Query("username") String username,
                                @Query("userpass") String userpass,
                                @Query("mobilenum") String mobilenum,
                                @Query("address") String address);

    //加入购物车
    @GET("addCart.do")
    Call<ResultBean> addCart(@Query("user_id") int user_id,
                             @Query("food_id") int food_id,
                             @Query("num") int num);

    //获取当前用户购物车
    @GET("getMyCartByUser.do")
    Call<List<CartBean>> getCart(@Query("user_id") int user_id);

    //从购物车中删除
    @GET("deleteCartItem.do")
    Call<ResultBean> deleteCart(@Query("item_id") int item_id);

    //购物车中选择下单
    @GET("getItemsFromCart.do")
    Call<List<CartBean>> getItemsFromCart(@Query("items") String items);

    //购物车中选择下单2
    @GET("insertOrder2.do")
    Call<ResultBean> insertOrder(@Query("items") String items);

    //上传头像
    @POST("updateAvatar.do")
    Call<UploadBean> uploadAvatar(@Body MultipartBody avatar);
}
